﻿using Wenyu.Framework.Common.Helpers;
using Wenyu.Framework.DbModels;
using Wenyu.Framework.DbModels.Entities;
using Wenyu.Framework.IBusinessServices;
using Wenyu.Framework.ModelDto;

namespace Wenyu.Framework.BusinessServices
{
    public class UserService : BaseService, IUserService
    {
        public UserService(FrameworkDbContext context) : base(context)
        {
        }

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="loginReq"></param>
        /// <returns></returns>
        public UserEntity? Login(LoginReq loginReq)
        {
            UserEntity? userEntity= this.Query<UserEntity>(x => x.UserName == loginReq.UserName && x.Password == Md5Helper.Encrypt(loginReq.Password)).FirstOrDefault();
            return userEntity;
        }
    }
}